package org.simtube.index;

import org.simtube.util.DocItem;
import org.simtube.util.DocVector;

public interface Index {
	
	/**
	 * Set the data matrix needed to do indexing
	 * @param docMat
	 * 		A matrix to describe those documents, each document corresponds to a vector.
	 *      One document is described by a row in the matrix.
	 * 		In our corpus, the size of our matrix is approximately 15000 by 250.
	 */
	public void setDocMat(DocItem[] docMat);
	
	/**
	 * Conduct a k-NN query on the constructed index structure
	 * @param k k results should be returned
	 * @param query A vector representing the query
	 * @return A list of k results that are most similar to the given query
	 */
	public int[] kNNQuery(int k, DocVector query);
	
	/**
	 * Build the index structure. This method should be invoked before any query
	 * processing is made.
	 */
	public void buildIndex();
	
	/**
	 * Load index from the specified index file
	 * @param indexFile The path and filename for the index file
	 */
	public void loadIndex(String indexFile);
}
